/***************************************************************************
*   Copyright (C) 2007 by Yuri Ovcharenko                                 *
*   amwsoft@gmail.com                                                     *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU General Public License for more details.                          *
*                                                                         *
*   You should have received a copy of the GNU General Public License     *
*   along with this program; if not, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/
#ifndef AT91SAM7S_H
#define AT91SAM7S_H

#include <QFrame>

/**
	@author Yuri Ovcharenko <amwsoft@gmail.com>
*/

class QSpinBox;
class QDoubleSpinBox;
class QLabel;
class QProgressBar;

class AT91SAM7S : public QFrame
{
		Q_OBJECT
	public:
		AT91SAM7S( QWidget *parent = 0 );
		~AT91SAM7S();

	public slots:
		void calc();
		void calcPLL();
		void calcMCK();
		void calcUSB();
		void calcDBGU();
		void calcUSART();
		void usbGuess();

	private:
		double usartSpeed(double clk, double cd, double over, double fp);

	private:
		QDoubleSpinBox *pllck;
		QSpinBox *mainck;
		QSpinBox *mul;
		QSpinBox *div;
		QSpinBox *pllMin;
		QSpinBox *pllMax;

		QDoubleSpinBox *mck;
		QSpinBox *mckPrescaler;

		QDoubleSpinBox *udpck;
		QSpinBox *udpPrescaler;
		QLabel *udpError;
		QProgressBar *uProgress;

		QSpinBox *dbguBaud;
		QDoubleSpinBox *dbguBaudResult;
		QSpinBox *dbguCD;
		QLabel *dbguError;

		QSpinBox *usartBaud;
		QSpinBox *usartOver;
		QDoubleSpinBox *usartBaudResult;
		QSpinBox *usartCD;
		QSpinBox *usartFP;
		QLabel *usartError;
};

#endif
